home *** CD-ROM | disk | FTP | other *** search
- package sun.tools.zip;
-
- import java.io.IOException;
- import java.io.InputStream;
-
- public class ZipReader implements ZipConstants {
- // $FF: renamed from: is java.io.InputStream
- private InputStream field_0;
- // $FF: renamed from: ze sun.tools.zip.ZipEntry
- private ZipEntry field_1;
- private ZipReaderInputStream zis;
- private byte[] lochdr = new byte[30];
-
- public ZipReader(InputStream var1) {
- this.field_0 = var1;
- }
-
- public boolean nextEntry() throws ZipFormatException, IOException {
- if (this.field_0 == null) {
- return false;
- } else {
- if (this.zis != null) {
- while(this.zis.count > 0) {
- this.zis.skip((long)this.zis.count);
- }
- }
-
- this.readFully(this.lochdr, 0, 4);
- byte[] var1 = this.lochdr;
- byte[] var2 = ZipConstants.LOCSIG;
- if (!ZipFile.checkSig(var1, 0, var2)) {
- var1 = this.lochdr;
- var2 = ZipConstants.CENSIG;
- if (ZipFile.checkSig(var1, 0, var2)) {
- return false;
- } else {
- this.field_0 = null;
- throw new ZipFormatException("Invalid LOC header signature");
- }
- } else {
- this.readFully(this.lochdr, 4, 26);
- var1 = this.lochdr;
- if ((var1[8] & 255 | (var1[9] & 255) << 8) != 0) {
- throw new ZipFormatException("Compressed entries not supported");
- } else {
- var1 = this.lochdr;
- if (((var1[6] & 255 | (var1[7] & 255) << 8) & 1) == 1) {
- throw new ZipFormatException("Encrypted entries not supported");
- } else {
- var1 = this.lochdr;
- var1 = new byte[var1[26] & 255 | (var1[27] & 255) << 8];
- this.readFully(var1, 0, var1.length);
- String var10 = new String(var1, 0, 0, var1.length);
- this.field_1 = new ZipEntry(var10);
- byte[] var3 = this.lochdr;
- this.field_1.length = (long)(var3[22] & 255 | (var3[23] & 255) << 8 | (var3[24] & 255 | (var3[25] & 255) << 8) << 16);
- var3 = this.lochdr;
- this.field_1.mtime = (long)(var3[12] & 255 | (var3[13] & 255) << 8 | (var3[14] & 255 | (var3[15] & 255) << 8) << 16);
- var3 = this.lochdr;
- long var14 = (long)(var3[28] & 255 | (var3[29] & 255) << 8);
- if (this.field_0.skip(var14) != var14 && true) {
- throw new ZipFormatException("Unexpected EOF");
- } else {
- this.zis = new ZipReaderInputStream(this.field_0, this.field_1);
- return true;
- }
- }
- }
- }
- }
- }
-
- public ZipEntry getEntry() {
- return this.field_1;
- }
-
- public InputStream getInputStream() {
- return this.zis;
- }
-
- private boolean readFully(byte[] var1, int var2, int var3) throws IOException {
- while(var3 > 0) {
- int var4 = this.field_0.read(var1, var2, var3);
- if (var4 == -1) {
- return false;
- }
-
- var2 += var4;
- var3 -= var4;
- }
-
- return true;
- }
-
- private boolean skip(long var1) throws IOException {
- return this.field_0.skip(var1) == var1;
- }
- }
-